<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:job="livcos.org/ns/process/job"
  xmlns="http://www.w3.org/1999/xhtml"
  exclude-result-prefixes="job">
  
  <xsl:output method="html" encoding="UTF-8"
    doctype-public="-//W3C//DTD HTML 4.01//EN"
    doctype-system="http://www.w3.org/TR/html4/strict.dtd" indent="no"/>
  
  <xsl:template match="/">
    <xsl:variable name="result" select="*/job:*[last()-1]/result"/>
    <xsl:choose>
      <xsl:when test="$result">
        <xsl:copy-of select="$result/*"/>
      </xsl:when>
      <xsl:otherwise>
        <html>
          <body>
            <h1>No Result Found!</h1>
            <textarea rows="30" cols="80">
              <xsl:copy-of select="*"/>
            </textarea>
          </body>
        </html>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>
  
</xsl:stylesheet>
